package com.lupan.guice.bindings.providerBindings;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.name.Named;
import com.lupan.guice.bindings.DatabaseTransactionLog;

/**
 * 说明：
 *
 * @author lupan
 * @version 2016/10/8 13:49
 */
public class DatabaseTransactionLogProvider implements Provider<DatabaseTransactionLog> {

    private final String jdbcUrl;
    private final int maxPoolSize;

    @Inject
    public DatabaseTransactionLogProvider(@Named("jdbcUrl") String jdbcUrl, @Named("maxPoolSize") int maxPoolSize) {
        this.jdbcUrl = jdbcUrl;
        this.maxPoolSize = maxPoolSize;
    }

    @Override
    public DatabaseTransactionLog get() {
        DatabaseTransactionLog log = new DatabaseTransactionLog();
        log.setJdbcUrl(jdbcUrl);
        log.setMaxPoolSize(maxPoolSize);
        return log;
    }
}
